package aop.MethodBeforeAdvice;

import org.springframework.aop.framework.ProxyFactoryBean;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import example.samples.ArithmeticCalculator;
import example.samples.UnitCalculator;


public class Main {
	public static void main(String[] args) {
		ApplicationContext springContext = new ClassPathXmlApplicationContext("aop/Advice/methodbeforeadvice.xml");
		
		ArithmeticCalculator arithmeticCalculator = (ArithmeticCalculator) springContext.getBean("arithmeticCalculatorProxy");
		
		UnitCalculator unitCalculator = (UnitCalculator) springContext.getBean("unitCalculatorProxy");
		
		
		arithmeticCalculator.add(3, 4);
		
		arithmeticCalculator.div(3, 0);
		
		unitCalculator.kilogramToPound(10);
	}
}
